The first century spans from the year 1 up to and including the year 100, The second - from the year 101 up to and including the year 200, etc.
找出該年度屬於哪個世紀
(ns century.core)
(defn century [year]
(int (Math/ceil (/ year 100))))
;; Example
monkeyCount(10) // --> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
monkeyCount(1) // --> [1]
(ns kata.monkey.count)
(defn monkey-count [n]
(range 1 (+ 1 n))
)
;; (inc x), increment function
;; Returns a number one greater than x.
(ns kata.monkey.count)
(defn monkey-count [n]
(range 1 (inc n))
)
(inc 1) ;; 2
(inc -1) ;; 0
(inc 1.0) ;; 2.0
(map inc [1 2 3 4 5]) ;; (2 3 4 5 6)
(into [] (map inc [1 2 3 4 5])) ;;[2 3 4 5 6]